# Api中间件层, 所以关于Api的请求都必须经过此中间件
from django.utils.deprecation import MiddlewareMixin


from django.http import JsonResponse

import time

# Api中间件
class Api(MiddlewareMixin):
    def process_request(self, request):
        # 获取域名 拼接
        request.IncentiveHubURL = request.scheme + "://" + request.META.get("HTTP_HOST")
        if "/api/" in request.path:
            # time.sleep(2)
            pass
        return None
    def process_response(self, request, response):
        return response



